﻿@{
    Layout = "~/Views/Samples/Generic/_Codebehind.cshtml";
}
@section cs_webforms_new
{
        protected void Page_PreRender(object sender, EventArgs e)
        {
            int maxFiles;
            int maxFileSize;

            if (int.TryParse(maxFilesTextBox.Text, out maxFiles))
            {
                slickUpload.MaxFiles = maxFiles;
            }

            if (int.TryParse(maxFileSizeTextBox.Text, out maxFileSize))
            {
                slickUpload.MaxFileSize = maxFileSize;
            }

            slickUpload.ConfirmNavigateDuringUploadMessage = confirmNavigateMessageTextBox.Text;
            slickUpload.ValidExtensions = validExtensionsTextBox.Text;
            slickUpload.InvalidExtensionMessage = fileTypeMessageTextBox.Text;
            slickUpload.InvalidFileSizeMessage = fileSizeMessageTextBox.Text;

            requiredFilesValidator.Enabled = requireFileSelectionCheckBox.Checked;

            summaryValidator.Text = summaryMessageTextBox.Text;
            summaryValidator.Enabled = !allowInvalidUploadCheckBox.Checked;
        }
}
@section vb_webforms_new {
        Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
            Dim maxFiles As Integer
            Dim maxFileSize As Integer

            If Integer.TryParse(maxFilesTextBox.Text, maxFiles) Then
                slickUpload.MaxFiles = maxFiles
            End If

            If Integer.TryParse(maxFileSizeTextBox.Text, maxFileSize) Then
                slickUpload.MaxFileSize = maxFileSize
            End If

            slickUpload.ConfirmNavigateDuringUploadMessage = confirmNavigateMessageTextBox.Text
            slickUpload.ValidExtensions = validExtensionsTextBox.Text
            slickUpload.InvalidExtensionMessage = fileTypeMessageTextBox.Text
            slickUpload.InvalidFileSizeMessage = fileSizeMessageTextBox.Text

            requiredFilesValidator.Enabled = requireFileSelectionCheckBox.Checked

            summaryValidator.Text = summaryMessageTextBox.Text
            summaryValidator.Enabled = Not allowInvalidUploadCheckBox.Checked
        End Sub
}